package com.kefu.exam.vo;

import cn.hutool.core.util.IdUtil;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.exam.model.ExamCascadeJump;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xiaoyu
 * @date 2022/10/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "级联跳转规则表")
public class ExamCascadeJumpInsertVo extends AbstractInsertVo<ExamCascadeJump> {

    @ApiModelProperty(value = "问卷id")
    private String paperId;
    @ApiModelProperty(value = "问题id")
    private String subjectId;
    @ApiModelProperty(value = "问题答案id")
    private String answerId;
    @ApiModelProperty(value = "跳转问题id")
    private String jumpSubject;
    private String from;

    @Override
    public ExamCascadeJump convert() {
	    ExamCascadeJump info  = BeanUtil.toBean(this, ExamCascadeJump.class);
        KefuContext context = KefuContext.getKefuContext();
        info.setCascadeId(IdUtil.simpleUUID());
	    info.setTenantId(context.getTenantId());
	    info.setCreateUser(context.getUserId());
	    info.setCreateTime(context.getNow());
	    info.setUpdateUser(context.getUserId());
	    info.setUpdateTime(context.getNow());
	    return info;
	}
}